
*shorter prefixes
global parent = ""
global pred = "pr"
global ppred = "ppr"
global predL1 = "pr1"

foreach v in pred parent {
	foreach x of varlist `v'_* {

		local x0 = substr("`x'",strlen("`v'_")+1,.)
		disp "`x' --> tyrc_${`v'}`x0'"
		rename `x' tyrc_${`v'}`x0'
	}
}

foreach v in pred  {
	foreach x of varlist i_`v'_* {
		local x0 = substr("`x'",strlen("i_`v'_")+1,.)
		disp "`x' --> tyrc_i${`v'}`x0'"
		capture rename `x' tyrc_i${`v'}`x0'
	}
}

rename i_obstaxyr tyrc_obstyr
capture rename tyrc_dependent parent_dependent

rename Lparent_have_1040 tyrc_L1040
rename Lparent_fil_stat tyrc_Lfil_stat

gen tyrc_Lfil_stat0 =tyrc_Lfil_stat
replace tyrc_Lfil_stat0 =0 if tyrc_L1040!=1

gen tyrc_married = (tyrc_fil_stat==2 |tyrc_fil_stat==3)
gen tyrc_Lmarried = (tyrc_Lfil_stat==2 |tyrc_Lfil_stat==3) if tyrc_Lfil_stat!=.
